<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // ES6中引入扩展运算符(展开语法)
        // 扩展运算符：可以展开数组和对象
        // 扩展运算符和剩余参数有相似的语法
        //    不同点：
        //         剩余参数，剩余解构把所有的多余的参数收集起来转换成数组或者对象
        //         扩展运算符把数组或者对象拆分成单个

        //数组展开
        let nums=[10,20,30,1,23,4,28];
        // console.log(Math.max(nums));
        console.log(Math.max(...nums));//将数组扩展成单个参数

        let arr1=["alice","baby"];
        let arr2=["cici","lili"];
        let arr3=["付正楠",...arr1,...arr2,"黄春鹏"];
        console.log(arr3);

        console.log(Math.max(...[10,2000,-100]));
        console.log(Math.min(...[9,2000,-1000]));


        //对象展开
        let obj1={id:1001,name:"杜俊"};
        let obj2={name:"alice",course:"html"};
        let obj3={gender:"男",...obj1,...obj2};
        console.log(obj3);

        let objs={gender:"Female",id:1002,name:"cici",course:"Web"};
        let {id,gender,...attrs}=objs;
        console.log(id,gender,attrs);

        
    </script>
</head>
<body>
    
</body>
</html>